<template>
  <view class="container">
    <!-- <view class="avatar">
			<u-upload ref="product_img" name="product_img" maxCount="1" :fileList="filelist" width="120" height="120"
				@delete="del" @afterRead="read" />
		</view> -->

    <view class="content">
      <u-form labelPosition="left" labelWidth="60" :model="prolist">
        <u-form-item label="评论人:">
          <u-input v-model="commentlist.business.nickname" disabled />
        </u-form-item>
        <u-form-item label="订单号:">
          <u-input disabled v-model="commentlist.order.code" />
        </u-form-item>

        <!-- 联系人 -->
		<u-form-item label="联系电话:" >
          <u--input v-model="commentlist.business.mobile" />
          <u-button
            slot="right"
            :customStyle="{
              width: '40px',
              height: '35px',
              marginLeft: '3px',
            }"
            @tap="getbusinessPhone"
            :text="'拨打'"
            type="primary"
            :plain="true"
            size="mini"
          ></u-button>
        </u-form-item>
        <!-- 名称 -->
        <u-form-item label="车牌号:">
          <u-input v-model="commentlist.hirename_text" disabled placeholder="车牌号未知" />
        </u-form-item>
        <u-form-item label="门店:">
          <u-input v-model="commentlist.store.name" disabled />
        </u-form-item>
        <!-- 品牌 -->
        <!-- <u-form-item label="品牌" prop="name">
					<u-input v-model="commentlist.name" disabled />
				</u-form-item> -->

        <!-- 参数1 -->
        <u-form-item label="服务评分:">
          <u-input v-model="commentlist.rate_text" disabled />
        </u-form-item>

        <!-- 参数2 -->

        <!-- 参数2 -->
        <u-form-item label="下单时间:">
          <u-input disabled v-model="commentlist.order.createtime_text" />
        </u-form-item>

        <!-- 商品描述 -->
        <u-form-item label="意见反馈:" prop="description" borderBottom>
          <u-textarea v-model="commentlist.comment" count disabled></u-textarea>
        </u-form-item>

        <!-- 参数3 -->
        <u-form-item label="评论时间:">
          <u-input v-model="commentlist.createtime_text" disabled />
        </u-form-item>

        <u-form-item label="租车费用:">
          <u-input disabled type="number" v-model="commentlist.order.amount" />
        </u-form-item>

        <!-- 提交按钮 -->
        <u-button
          text="确定审批"
          v-if="commentlist.status == 1"
          icon="pushpin"
          size="small"
          type="success"
          :customStyle="btnStyle"
          @click="shenpi"
        />
        <u-button
          text="回复拒绝"
          v-if="commentlist.status == 3"
          icon="pushpin"
          size="small"
          type="primary"
          :customStyle="btnStyle"
          @click="shenpi"
        />
      </u-form>
    </view>
    <!-- 消息提醒 -->
    <u-toast ref="notice"></u-toast>
  </view>
</template>
  
<script>
export default {
  onLoad(options) {
    this.comid = options.comid ? options.comid : 0;

    this.auth = this.$u.auth.check();
    this.info();
  },

  created() {
    this.timer = setInterval(() => {
      let a = this.$u.count.check();
    }, 15000);
  },
  beforeDestroy() {
    clearInterval(this.timer);
  },
  data() {
    return {
      comid: 0,
      // filelist: [],
      auth: {},
      commentlist: [],
      showbrank: false,
      param1: "",
      param2: "",
      param3: "",
      sf: 0,
      description: "",
      price: 0,
    };
  },

  methods: {
    getbusinessPhone() {
      wx.makePhoneCall({
        phoneNumber: this.commentlist.business.mobile, //仅为示例，并非真实的电话号码
      });
    },

    async shenpi() {
      let data = {
        comid: this.comid,
        status: 3,
        adminid: this.auth.id,
      };
      let result = await this.$u.api.depot.shenpiconfirm(data);

      if (result.code) {
        this.$refs.notice.show({
          type: "success",
          message: result.msg,
          duration: 1000,
          complete: () => {
            //返回上一个界面
            uni.reLaunch({
              url: "/pagesC/shenpi/index",
            });
          },
        });
      } else {
        this.$refs.notice.show({
          type: "danger",
          message: result.msg,
          duration: 2000,
        });
      }
    },
    async info() {
      let data = {
        comid: this.comid,
        adminid: this.auth.id,
      };
      let result = await this.$u.api.business.commentinfo(data);

      if (result.code) {
        this.commentlist = result.data;

        // if (this.commentlist.product.thumbs_text) {
        // 	this.filelist = [
        // 		{ url: this.commentlist.product.thumbs_text }
        // 	]
        // }
      } else {
        this.$refs.notice.show({
          type: "danger",
          message: result.msg,
          duration: 2000,
        });
      }
    },
  },
};
</script>
  
<style >
.content {
  padding: 20px;
}

.container {
  height: 100%;
  margin: 0 50rpx;
  box-sizing: border-box;
}

.avatar {
  text-align: center;
}

.u-avatar {
  margin: 80rpx auto 40rpx;
}

.xcx {
  width: 200rpx;
  height: 200rpx;
  margin: 80rpx auto 40rpx;
  border-radius: 100%;
  overflow: hidden;
}

.nickname {
  font-size: 14px;
  text-align: center;
}

.title {
  text-align: center;
  margin: 40rpx 0;
  font-size: 14rpx;
}

.avatar .u-upload {
  justify-content: center;
  align-items: center;
  margin: 3em auto;
}
</style>
  